﻿using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using eduscrum.Models;

namespace eduscrum.DAL
{
    public class SystemContext : DbContext
    {
        public DbSet<UserStory> UserStories { get; set; }
        public DbSet<Sprint> Sprints { get; set; }
        //public DbSet<Task> Tasks { get; set; }
        public DbSet<Phase> Phases { get; set; }
        public DbSet<Project> Projects { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            //modelBuilder.Conventions.Remove<System.Data.Entity.Infrastructure.IncludeMetadataConvention>();//http://weblogs.asp.net/shijuvarghese/archive/2011/10/06/removing-edmmetadata-table-in-ef-code-first.aspx
            modelBuilder.Entity<UserStory>().ToTable("tbl_UserStory");
            modelBuilder.Entity<Sprint>().ToTable("tbl_Sprint");
            //modelBuilder.Entity<Task>().ToTable("tbl_Task");
            modelBuilder.Entity<Phase>().ToTable("tbl_Phase");
            modelBuilder.Entity<Project>().ToTable("tbl_Project");
        }
    }
}